﻿@page "/"
@using ELS.Services
@inject NavigationManager NavigationManager
@inject IAccountService AccountService

<PageTitle>Home</PageTitle>

<MudText Typo="Typo.h3" GutterBottom="true">Hello, world!</MudText>
@if (LoggedIn)
{
	<MudText Typo="Typo.h5" GutterBottom="true">欢迎, @AccountService.User.Username!</MudText>
}
else
{
	<MudAlert Class="mb-8" Severity="Severity.Normal" Variant="Variant.Outlined">
		你好，欢迎使用 MudBlazor 和.NET 8 模板创建的新应用！点击下面的按钮登录。
	</MudAlert>
	<MudButton @onclick="() => LogIn()" Size="Size.Large" Color="Color.Primary" Variant="Variant.Filled">登录</MudButton>
}

@code {
	public bool LoggedIn
	{
		get { return AccountService.User != null; }
	}

	void LogIn()
	{
		NavigationManager.NavigateTo("/account/login");
	}
}